package com.ncs.base.common.rule;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtils {

    public static void main(String[] args) {

        System.out.println(previousDay(-8));

    }

    //获取之前日期
    public static String previousDay(int i){

        Calendar cal=Calendar.getInstance();
        cal.add(Calendar.DATE,i);
        Date d=cal.getTime();

        SimpleDateFormat sp=new SimpleDateFormat("yyyy-MM-dd");
        return sp.format(d);
    }
}
